#!/bin/bash

# ***************************************************************************
# * 
# * @file:start_uwsgi.sh 
# * @author:ebayboy@163.com 
# * @date:2019-11-29 00:19 
# * @version 1.0  
# * @description: Shell script 
# * @Copyright (c)  all right reserved 
#* 
#**************************************************************************/ 

PID=/var/run/uwsgi.pid
CFG=/var/www/webapp/uwsgi.ini

if [ "$1" == "start" ];then
	uwsgi --uid www --gid www --ini $CFG

	ps -ef | grep -w uwsgi | grep -v grep
	netstat -anpt | grep uwsgi

#start

elif [ "$1" == "reload" ];then
	uwsgi --reload $PID
#reload

elif [ "$1" == "stop" ];then
	uwsgi --stop $PID
	rm -ef $PID
#stop

elif [ "$1" == "status" ];then
	ps -ef | grep -w uwsgi | grep -v grep
	netstat -anpt | grep uwsgi
#status

else 
	echo "Usage:./$0 start|reload|stop|status "
fi

exit 0

